/*
 * StoppageList.java
 *
 * Created on April 12, 2007, 10:47 PM
 */

package busticketvendingsystem;

/**
 *
 * @author  Samik Saha
 */
public class StoppageList extends javax.swing.JDialog {
    ConnectDatabase cd;
    /** Creates new form StoppageList */
    public StoppageList(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        cd=new ConnectDatabase();
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jScrollPane1 = new javax.swing.JScrollPane();
        stoppageList = new javax.swing.JList();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setResizable(false);
        setUndecorated(true);
        addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                closeDialog(evt);
            }
        });

        stoppageList.setModel(new javax.swing.AbstractListModel() {
            String[] strings = cd.getStoppage_name();
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane1.setViewportView(stoppageList);

        getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void closeDialog(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_closeDialog
        StoppageList.this.dispose();
    }//GEN-LAST:event_closeDialog
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new StoppageList(null, true).setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JList stoppageList;
    // End of variables declaration//GEN-END:variables
    
}
